var InputManager = Class.extend({
	canvas: null,
	keyState: [],
	keyDirections: {
		"37": 'left',
		"38": 'up',
		"39": 'right',
		"40": 'down'
	},
	direction: null,

	init: function(canvas) {
		this.canvas = canvas;

		var that = this;
		window.addEventListener("keydown", function(e) {
			that.onKeyDown(e);
		});
		window.addEventListener("keyup", function(e) {
			that.onKeyUp(e);
		});
	},
	onKeyDown: function(e) {
		this.keyState[e.keyCode] = true;
		this.direction = this.keyDirections[e.keyCode];
	},
	onKeyUp: function(e) {
		this.keyState[e.keyCode] = false;
		this.direction = null;
	}
});